package org.nimi317.web_gis.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.nimi317.web_gis.entity.User;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author nimi317
 * @since 2024-04-13
 */
public interface UserMapper extends BaseMapper<User> {
    @Select("select * from user")
    @Results(value = {
            @Result(column = "u_name", property = "userName"),
            @Result(column = "u_email", property = "email"),
            @Result(column = "id", property = "id"),
            @Result(column = "id", property = "roles", many = @Many(select = "org.nimi317.web_gis.dao.RoleMapper.getRoleVoByUserId")),
    })
    Page<User> pageUsers(Page<User> page);
}
